module.exports = {
    SUCCESS: 0,
    VALIDATE_ERROR: 1001,
    VALIDATE_FAIL: 1002,
    LOGIN_ERROR: 8000,
    CAPTCHA_ERROR: 8001,
    PASSWORD_ERROR: 8002,
    SERVER_ERROR: 9000,
    getCode(code, message = null, returnObject = null) {
        switch (code) {
            case this.SUCCESS:
                return {
                    code: 0,
                    type: '请求成功',
                    message: '请求成功',
                    returnObject: returnObject
                }
                break
            case this.VALIDATE_ERROR:
                return {
                    code: 1001,
                    type: '参数错误',
                    message: message
                }
                break
            case this.VALIDATE_FAIL:
                return {
                    code: 1002,
                    type: '校验失败',
                    message: message
                }
                break
            case this.LOGIN_ERROR:
                return {
                    code: 8000,
                    type: '登陆失败',
                    message: '用户名或密码错误'
                }
                break
            case this.CAPTCHA_ERROR:
                return {
                    code: 8001,
                    type: '登陆失败',
                    message: '验证码错误'
                }
                break
            case this.PASSWORD_ERROR:
                return {
                    code: 8002,
                    type: '修改失败',
                    message: '原密码错误'
                }
                break
            case this.SERVER_ERROR:
                return {
                    code: 9000,
                    type: '服务器端错误',
                    message: message
                }
                break
            default:
                return {
                    code: 9999,
                    type: '请求错误',
                    message: '请求错误'
                }
        }
    }
}